export default class CouponBatch {
  id: number

  name: string

  describe?: string

  total?: number

  issuedCount: number

  usedCount: number

  type: number

  issueType: number

  expansionRule: string

  shopParticipationFlag: string

  thresholdAmount?: number

  parValue?: number

  discountRate?: number

  couponTime: number

  perPersonLimit?: number

  startTime: any

  endTime?: any

  isStackable: boolean

  updateTime: any

  createTime: any

  // 最大可膨胀（前端值）
  maximumExpandable: number | undefined

  // 最大可膨胀多少钱
  static maximumExpandable(expansionRule: string): number | undefined {
    if (expansionRule == null || (typeof expansionRule === 'string' && expansionRule.trim() === '')) return undefined
    const rule: number[] = JSON.parse(expansionRule)
    const values = Object.keys(rule).map((value) => parseFloat(value))
    return Math.max(...values)
  }
  // 折扣券用于折扣的计算值
  static discountRate(discountRate: number): number {
    return discountRate / 10
  }
}
